<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | Bigotry <3162875@qq.com>                               |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\admin\controller;

/**
 * Interest控制器
 */
class Interest extends AdminBase
{
    
    /**
     * Interest列表
     */
    public function InterestList()
    {
        $this->param['type']=1;
        $where = $this->logicInterest->getWhere($this->param);
        
        $this->assign('list', $this->logicInterest->getInterestList($where, 'a.*', 'a.id desc'));
        $this->assign('type',$this->param['type']);
        return $this->fetch('interest_list');
    }

    /**
     * Interest列表
     */
    public function InterestList1()
    {
        $this->param['type']=2;
        $where = $this->logicInterest->getWhere($this->param);

        $this->assign('list', $this->logicInterest->getInterestList($where, 'a.*', 'a.id desc'));
        $this->assign('type',$this->param['type']);
        return $this->fetch('interest_list');
    }
    
    /**
     * Interest添加
     */
    public function InterestAdd()
    {
        
        $this->InterestCommon();
        $this->assign('type',$this->param['type']);
        return $this->fetch('interest_edit');
    }
    
    /**
     * Interest编辑
     */
    public function InterestEdit()
    {
        
        $this->InterestCommon();
        $info = $this->logicInterest->getInterestInfo(['a.id' => $this->param['id']], 'a.*');

        
        $this->assign('info', $info);
        $this->assign('type', $info['type']);
        return $this->fetch('interest_edit');
    }
    
    /**
     * Interest添加与编辑通用方法
     */
    public function InterestCommon()
    {
        
        IS_POST && $this->jump($this->logicInterest->InterestEdit($this->param));

    }
    


    
    /**
     * 数据状态设置
     */
    public function setStatus()
    {
        
        $this->jump($this->logicAdminBase->setStatus('InterestAllocation', $this->param));
    }
}
